Skip to content

ci: add pip and hatch environment caching to reusable python build#76

Merged
crowecawcaw merged 1 commit intoaws-deadline:mainlinefrom
crowecawcaw:ci/add-build-caches
Apr 17, 2026
Merged

ci: add pip and hatch environment caching to reusable python build#76
crowecawcaw merged 1 commit intoaws-deadline:mainlinefrom
crowecawcaw:ci/add-build-caches

Conversation

@crowecawcaw
Copy link
Copy Markdown

What was the problem/requirement? (What/Why)

CI builds spent about half their time downloading dependencies and setting up environments.

What was the solution? (How)

Add cache: pip to setup-python for pip download caching. Add actions/cache for the full hatch virtualenv environment, keyed on OS, python version, and dependency file hashes. Uses HATCH_DATA_DIR to normalize the env path across platforms.

Release artifacts (PyPI packages, installers) are built in separate jobs with clean environments, so the cache does not affect published artifacts.

What is the impact of this change?

Faster builds

Tested on crowecawcaw/deadline-cloud PR #1 (3 OS × 7 Python versions = 24 jobs)

                      Cold Cache    Warm Cache    Savings
  ubuntu (avg)          2m57s         2m44s        ~7%
  macos (avg)           2m53s         2m23s       ~17%
  windows (avg)         5m50s         4m26s       ~24%

  Biggest wins:
    windows-latest 3.12    7m10s → 3m59s   (44%)
    macos-latest   3.13    3m08s → 1m40s   (47%)
    macos-latest   3.11    2m34s → 1m30s   (42%)

How was this change tested?

Tested in my fork, above.

Was this change documented?

n/a

Is this a breaking change?

No


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@crowecawcaw crowecawcaw requested a review from a team as a code owner April 17, 2026 16:39
Add cache: pip to setup-python for pip download caching.
Add actions/cache for the full hatch virtualenv environment, keyed on
OS, python version, and dependency file hashes. Uses HATCH_DATA_DIR to
normalize the env path across platforms.

Release artifacts (PyPI packages, installers) are built in separate
jobs with clean environments, so the cache does not affect published
artifacts.

Signed-off-by: Stephen Crowe <6042774+crowecawcaw@users.noreply.github.com>
@crowecawcaw crowecawcaw force-pushed the ci/add-build-caches branch from a375122 to 1ad9e0d Compare April 17, 2026 16:42
Copy link
Copy Markdown

@karthikbekalp karthikbekalp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I think we can add more comments on how the cache eviction takes place but that's a nit.

@crowecawcaw crowecawcaw merged commit ceee4b0 into aws-deadline:mainline Apr 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants